#include "Object3D.h"

glm::mat4 Object3D::viewProjectionMatrix(1.0f);

Object3D::Object3D()
    : position(0.0f),
      scaleVector(1.0f),
      rotateVector(0.0f),
      modelMatrix(1.0f){};

Object3D::~Object3D(){};

void Object3D::scale(glm::vec3 v) { scaleVector = v; }
void Object3D::scale(float x, float y, float z) { scaleVector = {x, y, z}; }

void Object3D::rotate(glm::vec3 v) { rotateVector = v; }
void Object3D::rotate(float x, float y, float z) { rotateVector = {x, y, z}; }

void Object3D::updateMatrix()
{
    modelMatrix = glm::identity<glm::mat4>();
    modelMatrix = translate(modelMatrix, position);
    modelMatrix = glm::rotate(modelMatrix, rotateVector.x, {1.f, 0.f, 0.f});
    modelMatrix = glm::rotate(modelMatrix, rotateVector.y, {0.f, 1.f, 0.f});
    modelMatrix = glm::rotate(modelMatrix, rotateVector.z, {0.f, 0.f, 1.f});
    modelMatrix = glm::scale(modelMatrix, scaleVector);
}

void Object3D::render() {
    updateMatrix();
}